package com.ddz.controller;

import com.ddz.utils.KaptchaUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@Controller
@RequestMapping("captchaController")
public class CaptchaController {

    @RequestMapping("createCaptcha")
    public void createCaptcha(HttpSession httpSession, HttpServletResponse response) throws IOException {

        //使用工具类返回验证码
        KaptchaUtil.createKaptchaImg(httpSession,response);

        System.out.println("验证码：" + httpSession.getAttribute("code").toString());

    }
}
